import React, { memo, useState } from "react";

import "./index.scss";
import { FormType } from "./mark";

import LoginForm from "./c-cpns/login";
import RegisterForm from "./c-cpns/register";

const HYAccount = memo(function () {
  const [formType, setFormType] = useState("register");
  const cut =  (data: FormType) => {
    setFormType(data);
  }

  return (
    <div className="hy-account-form">
      {formType !== "register" ? (
        <RegisterForm cut={cut} />
        ) : (
        <LoginForm cut={cut} />
      )}
    </div>
  );
});

export default HYAccount;
